<!--
 * @Author: FanWeiHua
 * @Date: 2021-07-26 15:40:10
 * @LastEditTime: 2021-08-03 13:41:22
 * @Description: 入口组件
-->
<template>
  <a-config-provider :locale="locale">
    <router-view></router-view>
  </a-config-provider>
</template>
<script>
import { LocaleProvider } from 'ant-design-vue';
import { i18nStore } from './common/i18n.js'; // 国际化
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN';
import { themeDefault, themeRed } from './static/antd-theme/indexLess.js';
export default {
  name: 'app',
  data() {
    return {
      locale: zhCN
    };
  },
  mounted() {
    /**
     * 主题切换demo
     */
    let className = 'theme-sky';
    setInterval(() => {
      if (className === 'theme-sky') {
        i18nStore.locale = 'en';
        className = 'theme-red';
        window.less.modifyVars({
          ...themeDefault
        });
      } else {
        className = 'theme-sky';
        i18nStore.locale = 'zh';
        window.less.modifyVars({
          ...themeRed
        });
      }
      document.body.setAttribute('class', className);
    }, 2000);
  },
  components: {
    LocaleProvider
  }
};
</script>
<style lang="less">
@import './index.less';
</style>
